import java.util.*;

public class Test {
    public static void main(String[] args) {
        Game game = new Game();
        List<Card> cardsList = game.crateCards();
        System.out.println("初始的牌：" + cardsList);
        game.shuffle(cardsList);
        System.out.println("洗过的牌：" + cardsList);
        List<List<Card>> hand = game.play(cardsList);
        for (int i = 0; i < hand.size(); i++) {
            System.out.println("第" + (i + 1) + "个人的牌是：" + hand.get(i));
        }
        System.out.println("剩下的牌为：" + cardsList);
    }



    //杨辉三角
    public static List<List<Integer>> generate(int numRows) {//二维数组的写法
        List<List<Integer>> list = new ArrayList<>();

        //第1行
        List<Integer> list1 = new ArrayList<>();
        list1.add(1);
        list.add(list1);

        //从第2行起
        for (int i = 1; i < numRows; i++) {
            //每一行的开始
            List<Integer> curRow = new ArrayList<>();
            curRow.add(1);

            //获取前一行
            List<Integer> preRow = list.get(i - 1);
            //每一行的中间
            for (int j = 1; j < i; j++) {
                int val1 = preRow.get(j);
                int val2 = preRow.get(j - 1);
                int val = val1 + val2;
                curRow.add(val);
            }

            //每一行的结尾
            curRow.add(1);
            list.add(curRow);
        }
        return list;
    }

    public static void main2(String[] args) {
        List<List<Integer>> list = generate(5);
        System.out.println(list);
    }



    public static void main1(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(10);
        list.add(11);

        ArrayList<Integer> tmpList = new ArrayList<>(list);
        tmpList.add(88);
        System.out.println(tmpList);
    }
}
